package com.yuwei.live

import com.yuwei.common.mvi.BaseViewModel

class LiveViewModel : BaseViewModel<LiveApiService, LiveIntent>() {
    override fun handleIntent(intent: LiveIntent) {
        when (intent) {
            is LiveIntent.getLiveList -> {
                httpRequest(apiService.getLiveList(intent.page, intent.pageSize), "getLiveList")
            }
            is LiveIntent.getRankingList -> {
                httpRequest(apiService.getRankingList(), "getRankingList")
            }
            is LiveIntent.getBannerList -> {
                httpRequest(apiService.getBannerList(), "getBannerList")
            }
            is LiveIntent.getGoodsList -> {
                httpRequest(apiService.getGoodsList(), "getGoodsList")
            }
            is LiveIntent.getAddCar -> {
                httpRequest(
                    apiService.addCar(intent.addCarBody), "getAddCar"
                )
            }
        }
    }
}